package com.cjkj.system.api.factory;

import com.cjkj.common.core.domain.R;
import com.cjkj.system.api.RemoteTJ03DataService;
import com.cjkj.system.api.domain.APITJ03BpData;
import com.cjkj.system.api.domain.APITJ03EcgData;
import com.cjkj.system.api.domain.APITJ03HrData;
import com.cjkj.system.api.domain.APITJ03RealTimeData;
import com.cjkj.system.api.domain.request.RecordsReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class RemoteTJ03DataServiceFallbackFactory implements FallbackFactory<RemoteTJ03DataService> {

    @Override
    public RemoteTJ03DataService create(Throwable cause) {
        log.error("系统服务调用失败:{}", cause.getMessage());

        return new RemoteTJ03DataService() {
            @Override
            public R<List<APITJ03HrData>> tj03HrRecords(RecordsReq req, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<APITJ03HrData> tj03LatestHrData(RecordsReq req, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<List<APITJ03BpData>> tj03BpRecords(RecordsReq req, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<List<APITJ03EcgData>> tj03ECGRecords(RecordsReq req, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<APITJ03RealTimeData> getTj03RealTimeData(List<RecordsReq> reqs, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<APITJ03RealTimeData> getLatestBatteryData(String equipmentNo, String source) {
                return R.fail("获取设备监测数据失败！");
            }

            @Override
            public R<APITJ03RealTimeData> getTJ03LatestData(String equipmentNo, String source) {
                return R.fail("获取设备监测数据失败！");
            }
        };
    }

}
